<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>千园千变，万班万课</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="icon" type="image/png" href="assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="stylesheet" href="assets/css/amazeui.min.css"/>
    <link rel="stylesheet" href="assets/css/admin.css">
    <link rel="stylesheet" href="assets/css/app.css">
    <style>
        tr td{
            vertical-align: middle !important;
        }
    </style>
</head>
<body data-type="generalComponents">
<div class="tpl-portlet-components">
    <div class="portlet-title">
        <ol class="am-breadcrumb">
            <li><a href="#" class="am-icon-home">首页</a></li>
            <li><a href="#">Amaze UI CSS</a></li>
            <li class="am-active">文字列表</li>
        </ol>
        <button class="refresh_btn"><i class="am-icon-refresh"></i></button>
    </div>
    <div class="tpl-block">
        <div class="am-g" style="margin-top: 20px">
            <div class="am-u-sm-12">
                <table class="am-table am-table-striped am-table-hover table-main  scroll-table  table-center am-table-bd"
                       id="table">
                    <thead>
                    <tr>
                        <th class="table-title">金额</th>
                        <th class="table-type">金额</th>
                        <th class="table-author ">说明</th>
                        <th class="table-author ">订单号</th>
                        <th class="table-type check_permission[0]">账号</th>
                        <th class="table-author check_permission[0]">机构名称</th>
                        <th class="table-author check_permission[0]">负责姓名</th>
                        <th class="table-author">交易时间</th>
                    </tr>
                    </thead>
                    <tbody></tbody>
                </table>
                <div class="am-cf">
                    <div class="am-fr">
                        <div class="am-pagination tpl-pagination" id="pagination"></div>
                    </div>
                </div>
                <hr>
            </div>
        </div>
    </div>
</div>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/amazeui.min.js"></script>
<script src="assets/js/layer.js"></script>
<script src="assets/js/jquery.cookie.js"></script>
<script src="assets/js/md5.min.js"></script>
<script src="assets/js/jquery.pagination.js"></script>
<script src="assets/js/jquery.serializejson.min.js"></script>
<script src="assets/js/request.js"></script>
<script src="assets/js/verification.js"></script>
<script src="assets/js/app.js"></script>
</body>
<script>
var page = '1'
var size = '10'
var search = ''
var type = ''
var total = 0
var listData = null
var loginData=JSON.parse($.cookie('loginData'))
function getDataList (callback) {
  AjaxRequest({
    url: '/agent/bill_list/',
    data: {page, size, search},
    succFun: function (res) {
      var data = res.data
      total = data.count
      var html = ''
      listData = res.data.list
      listData.forEach(function (d, i) {
        html += ` <tr>
                    <td>${d.bill_id}</td>
                    <td>
                        <span class="am-badge am-badge-${d.type==1?'primary':'default'}"> ${d.type==1?'+':'-'}${d.money}</span>
                    </td>
                    <td>${d.content}</td>
                    <td>${d.order_number||'--'}</td>
                      ${(function(){
                        if(loginData.type==0){
                          return `
                            <td>${d.username}</td>
                            <td>${d.institution_name}</td>
                            <td>${d.name}</td>

                          `}
                        })()}
                    <td>${d.add_time}</td>
                </tr>`
      })
      $('#table tbody').html(html)
      callback && callback()
    }
  })
}
function init () {
  getDataList(function () {
    $('#pagination').pagination({
      pageCount: Math.ceil(total / size),
      jump: true,
      coping: true,
      keepShowPN: true,
      prevContent: '«',
      nextContent: '»',
      jumpBtnCls: 'am-btn am-btn-primary',
      activeCls: 'am-active',
      callback: function (api) {
        page = api.getCurrent().toString()
        getDataList()
      }
    });
  })
}
init()


</script>
</html>